package Final;//该文件实现对比赛项目的创建和把项目名字、项目规则写入数据库
import java.awt.*;
import java.util.*;

import java.sql.*;

public class CreateFile_Student {

    public static void Create_Student() throws SQLException //创建表

    {
        String checkTable="show tables like \"Student\"";
        Connection conn = Sql.open();
        Statement stmt = (Statement) conn.createStatement();
        ResultSet resultSet=stmt.executeQuery(checkTable);
        if(resultSet.next() ) {//如果存在表
        }else{//不存在表，则创建
            String sql = "create table Student(ID varchar(100),name varchar(20),sex varchar (10),Origin varchar(100),Class varchar(100),age varchar(20),primary key(ID))";
            try {

                Statement stmt2 = conn.createStatement(); //静态操作sql语句

                stmt2.execute(sql);

            } catch (SQLException e) {

                e.printStackTrace();

            } finally {

                Sql.close(conn);

            }
        }



    }


}
